<me:UIVAKDBEZ x:Class="WPFExcelReport.TVA31"
                    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:ReflectionStudio.Components.UserControls;assembly=ReflectionStudio.Core" 
                    xmlns:ucd="clr-namespace:ReflectionStudio.Controls;assembly=ReflectionStudio.Controls"     
                    xmlns:me="clr-namespace:WPFExcelReport" 
                    xmlns:T="clr-namespace:WPFExcelReport;assembly=IntexBL"
                    xmlns:ex="clr-namespace:WPFExcelReport.Controls;assembly=ExControls" 
                    xmlns:V3="clr-namespace:WPFExcelReport;assembly=TVAKOLL" 
                    xmlns:SD="clr-namespace:WPFExcelReport;assembly=TSDDAT"  
                    xmlns:KD="clr-namespace:WPFExcelReport;assembly=TKDSTAMM"  
                    xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"   
                    xmlns:Localization="clr-namespace:Localization;assembly=Localization"
                    x:Name="TV"
                    Background="White"  
                    Loaded="Window_Loaded"
     >
    <me:UIVAKDBEZ.Resources>
        <CollectionViewSource  x:Key="vwMaster"/>       <CollectionViewSource  x:Key="vwDetail"/>
        <ucd:Divideby10  x:Key="d10"/>
        <ucd:BoolToVisibilityConverter  x:Key="bv"/>
        <ucd:Divideby100  x:Key="d100"/>
        <ucd:TIMES100  x:Key="X100"/>
        <ucd:TIMES10  x:Key="X10"/>
        <ucd:Divideby1000  x:Key="d1000"/>
         <ucd:PNumConverter  x:Key="pnum"/>
        <ucd:TextTrimmingConverter  x:Key="Trim"/>
        <ucd:GB2312Convert8859P1  x:Key="gb2312"/>
    </me:UIVAKDBEZ.Resources>
     <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"></RowDefinition>
            <RowDefinition Height="1*"></RowDefinition>
            <RowDefinition Height="Auto"></RowDefinition>
        </Grid.RowDefinitions>
        <StackPanel Grid.Column="0">
            <WrapPanel>
                <WrapPanel> 
                    <Grid Margin="10,0,0,0" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                            <ColumnDefinition Width="Auto"></ColumnDefinition>
                        </Grid.ColumnDefinitions>
                        <Button   Click="QueryXJCommand" Content="{Binding Source={Localization:Translate Word=XJ色号}}" Height="20" Margin="5,0,0,0" Width="Auto" />
                    </Grid>
                </WrapPanel>  
                <WrapPanel>
                    <Button   Click="NewCommand" Height="20" Margin="5,0,0,0" Width="24" ToolTip="{Binding Source={Localization:Translate Word=新建}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/Add.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="{Binding IsNew,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <KD:TSKD02  Grid.Column="0"
                                Name="cSKD"
                                KEY="{Binding KUNDNR, ElementName=TV}" 
                                IsEdit="True"
                                KEY1="{Binding KDKUNDNA,ElementName=TV}"/>
                            <TextBlock Grid.Column="1" Visibility="Collapsed" 
                              Text="{Binding KDKUNDNA, ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="150" />
                        </Grid>
                        <Grid Margin="10,0,0,0" VerticalAlignment="Top" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock Visibility="Collapsed" Grid.Column="0" Text="{Binding Source={Localization:Translate Word=系列:}}"></TextBlock>
                            <V3:TSVA02 Grid.Column="1" Visibility="Collapsed"
                               Name="cSVA02"
                               IsEdit="True"
                               KEY="{Binding KOLL,ElementName=TV}" />
                        </Grid>
                        <Grid Margin="10,0,0,0" >
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=颜色类:}}"></TextBlock>
                            <SD:TSSD0561 Name="cTSSD0561"                                  
                                 Grid.Column="1"  dwKEY="{Binding Path=dwSD561,ElementName=TV}"/>
                            <Button  Grid.Column="2" Click="GetColorNo" Height="30" Margin="5,0,0,0" Width="30" Name="cGetColorNo" >
                                <Button.Background>
                                    <ImageBrush  ImageSource="/ImagePackage;component/Images/Reload.png" />
                                </Button.Background>
                            </Button>
                        </Grid>
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=色号:}}"></TextBlock>
                            <ex:TXT72 Grid.Column="1"   CharacterCasing="Upper" MaxLength="10" 
                                                Text="{Binding FARBE,ElementName=TV}" Width="80" />
                        </Grid>
                        <!--<Button  Grid.Column="3" Click="NewCommand" IsEnabled="{Binding IsGetNo,ElementName=TV}"  Height="30" Margin="5,0,0,0" Width="30"  >-->
                            <Button  Grid.Column="3" Click="NewCommand" IsEnabled="True"  Height="30" Margin="5,0,0,0" Width="30"  >
                                <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock Grid.Column="2" Text="必须选择一个客户" Foreground="Red" Visibility="{Binding IsKDFound,ElementName=TV,Converter={StaticResource bv}}"/>

                    </WrapPanel>
                </WrapPanel>
                <WrapPanel>
                    <Button    Click="CopyCommand" Height="20" Margin="5,0,0,0" Width="24" ToolTip="{Binding Source={Localization:Translate Word=复制}}">
                        <Button.Background>
                            <ImageBrush  ImageSource="/ImagePackage;component/Images/copy.png" />
                        </Button.Background>
                    </Button>
                    <WrapPanel Visibility="{Binding IsCopy,ElementName=TV,Converter={StaticResource bv}}">
                        <Grid Margin="10,0,0,0">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <KD:TSKD02  Grid.Column="0" KEY="{Binding KUNDNR, ElementName=TV}"  Name="cKD02"
                                        IsEdit="True"
                                        KEY1="{Binding KDKUNDNA,ElementName=TV}"/>
                            <TextBlock Grid.Column="1" Visibility="Collapsed" 
                              Text="{Binding KDKUNDNA, ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="150" />
                        </Grid>
                        <Button  Grid.Column="3" Click="CopyCommand" Height="30" Margin="5,0,0,0" Width="30"  >
                            <Button.Background>
                                <ImageBrush  ImageSource="/ImagePackage;component/Images/button_ok.png" />
                            </Button.Background>
                        </Button>
                        <TextBlock Grid.Column="2" Text="必须选择一个客户" Foreground="Red" Visibility="{Binding IsKDFound,ElementName=TV,Converter={StaticResource bv}}"/>

                    </WrapPanel>
                </WrapPanel>
                <Button Click="DeleteCommand" Height="20" Margin="5,0,0,0" Width="24"  ToolTip="删除" Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"
                         >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Remove.png" />
                    </Button.Background>
                </Button>
                <TextBlock  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}"  Foreground="Red" Text="请设定标志为Y"/>
                <TextBox Name="cDEL"  Visibility="{Binding IsEdit,ElementName=TV,Converter={StaticResource bv}}" Text="N"/>
            </WrapPanel>
            <WrapPanel>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <!--TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户:}}"></TextBlock-->
                    <KD:TSKD02  Grid.Column="1"  KEY="{Binding KUNDNR, ElementName=TV}"/>
                    <TextBlock Grid.Column="2"  Background="White" HorizontalAlignment="Right"
                               Text="{Binding KUNDNR,ElementName=TV}" Width="80" /> 
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=季节:}}"></TextBlock>
                    <TextBox Grid.Column="1" KeyUp="QUERY_KeyUp"  Background="White" CharacterCasing="Upper"   Text="{Binding KOLL,ElementName=TV}" Width="40" />
                </Grid>
               
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=色号:}}"></TextBlock>
                    <TextBox Grid.Column="1"  KeyUp="QUERY_KeyUp"  Background="White" CharacterCasing="Upper" 
                             Text="{Binding FARBE,ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="80" />
                </Grid>
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock   Grid.Column="0" Text="{Binding Source={Localization:Translate Word=客户色号:}}"></TextBlock>
                    <TextBox Grid.Column="1" KeyUp="QUERY_KeyUp"  Background="White" CharacterCasing="Upper" 
                             Text="{Binding KDFARBNR,ElementName=TV, Converter={StaticResource ResourceKey=gb2312}}" Width="120" />
                </Grid> 
                <Grid Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0"  Text="{Binding Source={Localization:Translate Word=客户色名:}}"></TextBlock>
                    <TextBox   Grid.Column="1" KeyUp="QUERY_KeyUp" Background="White" CharacterCasing="Upper"
                             Text="{Binding DES,ElementName=TV,Converter={StaticResource ResourceKey=gb2312},UpdateSourceTrigger=PropertyChanged}" Width="200" />
                </Grid>
                <Grid  Margin="10,0,0,0">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                        <ColumnDefinition Width="Auto"></ColumnDefinition>
                    </Grid.ColumnDefinitions>
                    <TextBlock  Grid.Column="0" Text="{Binding Source={Localization:Translate Word=基础色:}}"></TextBlock>
                    <TextBox Grid.Column="1"  KeyUp="QUERY_KeyUp"  Background="White" CharacterCasing="Upper" 
                             Text="{Binding ART,ElementName=TV,Converter={StaticResource ResourceKey=gb2312}}" Width="80" />
                </Grid>
                <Button   Click="QueryCommand" Height="30" Margin="5,0,0,0" Width="30" ToolTip="{Binding Source={Localization:Translate Word=查询}}" >
                    <Button.Background>
                        <ImageBrush  ImageSource="/ImagePackage;component/Images/Search.png" />
                    </Button.Background>
                </Button>
            </WrapPanel> 
        </StackPanel>
        <DataGrid  Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2"
                   VerticalAlignment="Top"  
                   AutoGenerateColumns="False"
                   EnableRowVirtualization="False"
                   VerticalScrollBarVisibility="Auto"
                   HorizontalScrollBarVisibility="Auto" 
                   HeadersVisibility="Column"           
                   IsReadOnly="True"
                   ItemsSource="{Binding Source={StaticResource vwMaster}}"  
                   IsSynchronizedWithCurrentItem="True"
                >
            <DataGrid.Columns>
                <DataGridTextColumn Binding="{Binding Path=KDKUNDNA, Converter={StaticResource ResourceKey=gb2312}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=客户}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBKOLL, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=季节}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBFARBE, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAFBEZ, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"   IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=颜色描述}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBKDFARBNR, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=客户色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBKDARTBEZ, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=客户色名}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CGRP, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=颜色组}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CR, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=R红}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CG, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=G绿}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=CB, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=B兰}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESANT1, Converter={StaticResource ResourceKey=d10}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=比例1}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESBEZ1, Converter={StaticResource ResourceKey=gb2312}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=成份1}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESANT2, Converter={StaticResource ResourceKey=d10}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=比例2}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESBEZ2, Converter={StaticResource ResourceKey=gb2312}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=成份2}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESANT3, Converter={StaticResource ResourceKey=d10}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=比例3}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAAGESBEZ3, Converter={StaticResource ResourceKey=gb2312}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=成份3}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBNEUBEN, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=创建人}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=KBNEUDAT, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=创建日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBAENDBEN, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=修改人}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=KBAENDDAT, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=修改日期}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=VAKBART, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=色号}}"  Width="Auto" />
                <DataGridTextColumn Binding="{Binding Path=STA, Converter={StaticResource ResourceKey=Trim}, Mode=TwoWay}"  IsReadOnly="True" Header="{Binding Source={Localization:Translate Word=色库是否插入}}"  Width="Auto" />


            </DataGrid.Columns>
        </DataGrid  >
        <ex:TPage Grid.Row="2"
            Visibility="{Binding IsPage,ElementName=TV,Converter={StaticResource bv}}"
                  />
    </Grid>
</me:UIVAKDBEZ>
